package com.xuhj.readexcel;


import com.xuhj.domain.Person;
import com.xuhj.export.factory.ExcelFactory;
import com.xuhj.readexcel.factory.ReadExcelFactory;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.core.io.ClassPathResource;

import java.io.FileInputStream;
import java.util.List;

public class TestImport {
    public static void main(String[] args) throws Exception {


        //导入 Excel
        FileInputStream in = new FileInputStream(new ClassPathResource("export/export.xlsx").getPath());
        XSSFWorkbook workbook = new XSSFWorkbook(in);
        List<Person> personList = ReadExcelFactory.readExcel(workbook,Person.class);
        in.close();
        //遍历结果
        for (Person person : personList) {
            System.out.println(person);
        }


    }
}
